package com.jefe.bamboo.service.model;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;


public class UserPrefsBmbClp extends BaseModelImpl<UserPrefsBmb>
    implements UserPrefsBmb {
    private String _bmbHost;
    private int _bmbPort;
    private long _bmbId;
    private String _bmbUser;
    private String _bmbPass;

    public UserPrefsBmbClp() {
    }

    public long getPrimaryKey() {
        return _bmbId;
    }

    public void setPrimaryKey(long pk) {
        setBmbId(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_bmbId);
    }

    public String getBmbHost() {
        return _bmbHost;
    }

    public void setBmbHost(String bmbHost) {
        _bmbHost = bmbHost;
    }

    public int getBmbPort() {
        return _bmbPort;
    }

    public void setBmbPort(int bmbPort) {
        _bmbPort = bmbPort;
    }

    public long getBmbId() {
        return _bmbId;
    }

    public void setBmbId(long bmbId) {
        _bmbId = bmbId;
    }

    public String getBmbUser() {
        return _bmbUser;
    }

    public void setBmbUser(String bmbUser) {
        _bmbUser = bmbUser;
    }

    public String getBmbPass() {
        return _bmbPass;
    }

    public void setBmbPass(String bmbPass) {
        _bmbPass = bmbPass;
    }

    public UserPrefsBmb toEscapedModel() {
        if (isEscapedModel()) {
            return this;
        } else {
            UserPrefsBmb model = new UserPrefsBmbClp();

            model.setEscapedModel(true);

            model.setBmbHost(HtmlUtil.escape(getBmbHost()));
            model.setBmbPort(getBmbPort());
            model.setBmbId(getBmbId());
            model.setBmbUser(HtmlUtil.escape(getBmbUser()));
            model.setBmbPass(HtmlUtil.escape(getBmbPass()));

            model = (UserPrefsBmb) Proxy.newProxyInstance(UserPrefsBmb.class.getClassLoader(),
                    new Class[] { UserPrefsBmb.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public Object clone() {
        UserPrefsBmbClp clone = new UserPrefsBmbClp();

        clone.setBmbHost(getBmbHost());
        clone.setBmbPort(getBmbPort());
        clone.setBmbId(getBmbId());
        clone.setBmbUser(getBmbUser());
        clone.setBmbPass(getBmbPass());

        return clone;
    }

    public int compareTo(UserPrefsBmb userPrefsBmb) {
        long pk = userPrefsBmb.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        UserPrefsBmbClp userPrefsBmb = null;

        try {
            userPrefsBmb = (UserPrefsBmbClp) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = userPrefsBmb.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{bmbHost=");
        sb.append(getBmbHost());
        sb.append(", bmbPort=");
        sb.append(getBmbPort());
        sb.append(", bmbId=");
        sb.append(getBmbId());
        sb.append(", bmbUser=");
        sb.append(getBmbUser());
        sb.append(", bmbPass=");
        sb.append(getBmbPass());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("com.jefe.bamboo.service.model.UserPrefsBmb");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>bmbHost</column-name><column-value><![CDATA[");
        sb.append(getBmbHost());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbPort</column-name><column-value><![CDATA[");
        sb.append(getBmbPort());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbId</column-name><column-value><![CDATA[");
        sb.append(getBmbId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbUser</column-name><column-value><![CDATA[");
        sb.append(getBmbUser());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>bmbPass</column-name><column-value><![CDATA[");
        sb.append(getBmbPass());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
